<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=utf-8"%>
<%@ include file="/includes/main.jsp"%>

<form id="pagerForm" action="partnerBook.action">
	<input type="hidden" name="pageInfo.currentPage" value="${pageInfo.currentPage}" />
	<input type="hidden" name="pageInfo.sorterName" value="${pageInfo.sorterName}" />
	<input type="hidden" name="pageInfo.sorterDirection" value="${pageInfo.sorterDirection}" />
	<input type="hidden" name="lookup" value="${lookup}" />
</form>

<div class="pageHeader">
	<form rel="pagerForm" method="post" action="partnerBook.action?lookup=${lookup}" onsubmit="return dwzSearch(this, '${targetType}');">
	<input type="hidden" name="pageInfo.pageSize" value="${pageInfo.pageSize}" />
	<div class="searchBar">
		<ul class="searchContent">	
			<li>
				<label><hi:text key="线路名称" entity="Trip"/>:</label>
				<input type="text" name="pageInfo.trip_model.f_trip_name" value="${pageInfo.trip_model.f_trip_name}"/>
			</li>	  
			<li class="dateRange">
				<label><hi:text key="开班日期" entity="Trip"/>:</label>
				<input type="text" name="pageInfo.f_trip_date" class="date" readonly="readonly" value="<fmt:formatDate value='${pageInfo.f_trip_date}' pattern='yyyy-MM-dd'/>"/>
				<input type="hidden" name="pageInfo.f_trip_date_op" value="&gt;="><span class="limit">-</span>
				<input type="text" name="pageInfo.f_trip_date01" class="date" readonly="readonly" value="<fmt:formatDate value='${pageInfo.f_trip_date01}' pattern='yyyy-MM-dd'/>"/>
				<input type="hidden" name="pageInfo.f_trip_date01_op" value="&lt;=">
			</li>	  
		</ul>
		<div class="subBar">
			<div class="buttonActive"><div class="buttonContent"><button type="submit"><hi:text key="查询"/></button></div></div>
		</div>
	</div>
	</form>
</div>
<div class="pageContent">
	<div class="panelBar">
		<ul class="toolBar">
		<c:choose>
			<c:when test="${empty lookup}">
				<authz:authorize ifAnyGranted="TRIP_DEL"><li><a class="delete" href="<hi:url>tripRemoveAll.action?ajax=1</hi:url>" target="removeSelected" title="<hi:text key="确实要删除这些记录吗?"/>"><span><hi:text key="批量删除"/></span></a></li></authz:authorize>
			</c:when>
			<c:otherwise>
				<li><a class="icon" href="javascript:$.bringBack({id:'-1', trip_name:'',price:'',seats_available:'',trip_date:''})"><span><hi:text key="重置"/></span></a></li>
			</c:otherwise>
		</c:choose>			
		</ul>
	</div>
	<table class="table" width="100%" layoutH="138" targetType="${targetType}">
		<thead>
			<tr>

				<th orderField="trip_model.trip_name" class="${pageInfo.sorterName eq 'trip_model.trip_name' ? pageInfo.sorterDirection : ''}"><hi:text key="线路名称" entity="Trip"/></th>
				<th orderField="trip_date" class="${pageInfo.sorterName eq 'trip_date' ? pageInfo.sorterDirection : ''}"><hi:text key="开班日期" entity="Trip"/></th>
				<th orderField="trip_code" class="${pageInfo.sorterName eq 'trip_code' ? pageInfo.sorterDirection : ''}"><hi:text key="班次编号" entity="Trip"/></th>
				<th orderField="price" ><hi:text key="基础价" entity="Trip"/></th>
				<th orderField="discountPrice" ><hi:text key="折扣价" entity="Trip"/></th>
				<th orderField="seats_available" class="${pageInfo.sorterName eq 'seats_available' ? pageInfo.sorterDirection : ''}"><hi:text key="限额" entity="Trip"/></th>
				
				<th width="90">
					<c:choose>
						<c:when test="${empty lookup}"><hi:text key="操作"/></c:when>
						<c:otherwise><hi:text key="查找带回"/></c:otherwise>
					</c:choose>
				</th>
			</tr>
		</thead>				
		<tbody>
			<c:forEach var="item" items="${trips}" varStatus="s">
			<tr>
			
				    <td><authz:authorize ifAnyGranted="TRIPMODEL_VIEW">
				    <a href="<hi:url>tripModelView.action?tripModel.id=${item.trip_model.id}&workflow=-1</hi:url>" target="dialog">
				    </authz:authorize>
					${item.trip_model.trip_name}
					<authz:authorize ifAnyGranted="TRIPMODEL_VIEW"></a></authz:authorize>
					</td>
					<td><fmt:formatDate value="${item.trip_date}" pattern="yyyy-MM-dd"/></td>
					<td>${item.trip_code}</td>
				    <td>
				    	${item.price}
				    </td>
				    <td>
				    	${item.discountPrice}
				    </td>
				    <td>${item.seats_available}</td>
					
				<td>


				    <authz:authorize ifAnyGranted="TRIP_VIEW">
				      <a class="btnView" href="<hi:url>tripView.action?trip.id=${item.id}</hi:url>" target="navTab" rel="trip" title="<hi:text key="查看" parameterLanguageKeys="班次"/>"><hi:text key="查看"/></a>
				    </authz:authorize>
				    <authz:authorize ifAnyGranted="TRIP_SAVE">
				      <a class="btnSelect" href="<hi:url>partnerNewOrder.action?tripId=${item.id}</hi:url>" target="navTab" rel="trip" title="<hi:text key="预订线路" parameterLanguageKeys=""/>"><hi:text key="预订线路"/></a>
				    </authz:authorize>

				</td>
			</tr>
			</c:forEach>
		</tbody>
	</table>	
	<div class="panelBar">
		<div class="pages">
			<span><hi:text key="每页"/></span>
			<c:set var="pageSizeList" value="${fn:split('10|20|50|100', '|')}"/>  
			<select name="pageInfo.pageSize" onchange="dwzPageBreak({targetType:'${targetType}', numPerPage:this.value})">
				<c:forEach var="item" items="${pageSizeList}">
				<option value="${item}" ${item eq pageInfo.pageSize ? 'selected="selected"' : ''}>${item}</option>
				</c:forEach>
			</select>
			<span><hi:text key="条"/>，<hi:text key="共"/>${pageInfo.totalRecords}<hi:text key="条"/></span>
		</div>
		<div class="pagination" targetType="${targetType}" totalCount="${pageInfo.totalRecords}" numPerPage="${pageInfo.pageSize}" pageNumShown="${pageInfo.middlePageNum*2}" currentPage="${pageInfo.currentPage}"></div>
	</div>
</div>
